package com.zy.ivideo.repository;

import com.zy.ivideo.entity.UserEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

/**
 * 用户模块数据仓库
 */
@Transactional
@Repository
public interface UserRepository extends JpaRepository<UserEntity,Long> {
    @Modifying
    @Query(nativeQuery=true,value="update s_user set password=?1 where id=?2")
    void modifyPwd(String newPwd,int userid);

    @Modifying
    @Query(nativeQuery=true,value="update s_user set accountid=?1 where id=?2")
    int modifyAccountId(long accountId,long userid);
}
